package com.gemme.gemme.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.gemme.gemme.R;

public class TvTvArrow extends RelativeLayout {
    private Context context;

    public TvTvArrow(Context context) {
        this(context,null);
    }

    public TvTvArrow(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public TvTvArrow(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
        initView();
    }
    TextView leftTv;
    TextView rightTv;
    ImageView arrow;
    ImageView iv_left;
    private void initView() {
        LayoutInflater.from(context).inflate(R.layout.tv_tv_arrow,this);

        leftTv = findViewById(R.id.leftTv);

        rightTv = findViewById(R.id.rightTv);

        arrow = findViewById(R.id.arrow);
        iv_left = findViewById(R.id.iv_left);
    }
    public TvTvArrow setLeftImage(int resouce){
        iv_left.setBackgroundResource(resouce);
        iv_left.setVisibility(VISIBLE);
        return this;
    }

    public TvTvArrow setLeftText(String leftText){
        leftTv.setText(leftText + "");
        return this;
    }

    public TvTvArrow setRightText(String rightText){
        rightTv.setText(rightText + "");
        rightTv.setVisibility(VISIBLE);
        return this;
    }

    public String getRightText(){
        return rightTv.getText() + "";
    }

    public TvTvArrow setRightTextColor(int color){
        rightTv.setTextColor(color);
        rightTv.setVisibility(VISIBLE);
        return this;
    }

    public TvTvArrow setRightVisble(boolean isvisble){
        if(isvisble){
            rightTv.setVisibility(VISIBLE);
        }else{
            rightTv.setVisibility(GONE);
        }

        return this;
    }

    public TvTvArrow setArrowVisble(boolean isvisble){
        if(isvisble){
            arrow.setVisibility(VISIBLE);
        }else{
            arrow.setVisibility(GONE);
        }
        return this;
    }
}
